package com.awb.rabbitmqdemo.topics;

import com.awb.rabbitmqdemo.entity.MessageBody;
import com.awb.rabbitmqdemo.routing.RoutingConfig;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicConsumer {

    @RabbitListener(queues = TopicsConfig.TOPICS_QUEUE_INFO)
    @RabbitHandler
    public void processOne(MessageBody<String> messageBody){
        System.out.println("topic监听消息"+messageBody);
    }

    @RabbitListener(queuesToDeclare = @Queue(TopicsConfig.TOPICS_QUEUE_ERROR))
    @RabbitHandler
    public void processTwo(MessageBody<String> messageBody){
        System.out.println("topic监听消息"+messageBody);
    }
}
